//=============================================================================
// XBus 
//-----------------------------------------------------------------------------
// File        : xbus_interface.h
// Description : XBus version file
// Author      : Ismail Sabry
// Date        : 1/30/2009
//=============================================================================
#ifndef __XBUS_INTERFACE_H__
#define __XBUS_INTERFACE_H__

#include <xbus.h>

//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------
#define XBUS_CONSUMER     0
#define XBUS_FEEDER       1

typedef struct {
  char                name[XBUS_SIZE_NAME];
  unsigned int        id;   // module id
  int                 type; // feeder / consumer

  t_XBUS              *xbus;
  t_XBUS_module       *module;
  t_XBUS_cell         *cell;

  t_XBUS_cell         *first;
  
  unsigned int        riter;
  unsigned int        rcell;

} t_XBUS_interface;

//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------
int XBUS_link(t_XBUS_interface *interface, 
	      int type, char *xbus_name, int xbus_id);
int XBUS_unlink(t_XBUS_interface *interface);
int XBUS_write(t_XBUS_interface *interface, unsigned char *buf, unsigned int len);
int XBUS_read(t_XBUS_interface *interface, unsigned char *buf, unsigned int len);

#endif //__XBUS_INTERFACE_H__
